UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VyPXgx+sEdo1zKdoE25oap76X/ISbFRs7vKp0+BW2mk=' 
WHERE 
  key_id = '2e1c7dda4667dfaca741f5af9d44323f75a5bc5508b6f00be71ab47257b8a4c0' 
  AND (
    token = 'VyPXgx+sEdo1zKdoE25oap76X/ISbFRs7vKp0+BW2mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023