UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q+v8E5LTI+n0eDnBKlUvUObGiyyyzHREQqXnkFLzYZc=' 
WHERE 
  key_id = '7b41df46a2efe6c6a491b5efa927ae358768f30b36230c36f4832b56a8b41343' 
  AND (
    token = 'q+v8E5LTI+n0eDnBKlUvUObGiyyyzHREQqXnkFLzYZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043