UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NDj+J7NM+EB4T5YWJK9aIZDqTCrkqsdrdlA/R+LpqEs=' 
WHERE 
  key_id = '0470bc9d665e8eb47d32264be98f4c82dfec803b762c99b135a3c2df3a7b59bf' 
  AND (
    token = 'NDj+J7NM+EB4T5YWJK9aIZDqTCrkqsdrdlA/R+LpqEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025