UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YcsNtyt9cqZDJK75P8/g0oD8JLu1eLzjJ2Q2cKXZOmQ=' 
WHERE 
  key_id = 'c9e1858c753ca26d3b8fa21ca190385b86a5c77ab1e3b146f8c877c3d7de9cb4' 
  AND (
    token = 'YcsNtyt9cqZDJK75P8/g0oD8JLu1eLzjJ2Q2cKXZOmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031