UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'putBCHPQ7ieIFeM22NoItaeVhpGn4reeudHmnNz374s=' 
WHERE 
  key_id = '2eb8a35b2d1c446b8320a73968e8d8e45f3c9e29cf3e2e1766fe9351dd6ac78b' 
  AND (
    token = 'putBCHPQ7ieIFeM22NoItaeVhpGn4reeudHmnNz374s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063