UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6yOhlA+5s4CfkizfoE8FLciObnf/M/iRAA3LzMS4r+A=' 
WHERE 
  key_id = '96798fb5dc8a4312dac0ab5a0d996483268997c955b5a856422809397b1e1a01' 
  AND (
    token = '6yOhlA+5s4CfkizfoE8FLciObnf/M/iRAA3LzMS4r+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021