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

Query time 0.00051