UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+idIwL1z5PbazWkCst0GwzLBM1SeP/XdV6MddDb+2+I=' 
WHERE 
  key_id = 'd9bdc080b439cc0b87849afc88c4735684600d76a3ad4dde3889cef815369f21' 
  AND (
    token = '+idIwL1z5PbazWkCst0GwzLBM1SeP/XdV6MddDb+2+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025