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

Query time 0.00025