UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J0o1ZGS9SqaJSWS4X01MSTSQhTCUw2ptWYcKfMHa0us=' 
WHERE 
  key_id = 'f6d0d01488cdb15007f2900bf03f2050c4f44e26155604ef1bda8724c6379231' 
  AND (
    token = 'J0o1ZGS9SqaJSWS4X01MSTSQhTCUw2ptWYcKfMHa0us=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026