UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UWsT69ycksBQqvr1b6fv+pHgAClXXpMt3rURydKRbRo=' 
WHERE 
  key_id = '695fc252c0aed85dc1669a9201eb8839d1a874a6e0f15c56b1ce34eceab3f674' 
  AND (
    token = 'UWsT69ycksBQqvr1b6fv+pHgAClXXpMt3rURydKRbRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023