UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FYk9/iuvlhJfv8uSSCagoUHWA20PSOFj82ofpEtyb64=' 
WHERE 
  key_id = 'f791bae1a5ec38081757b9c01d41c89ec55db154f867adc26ff7b32edf833d23' 
  AND (
    token = 'FYk9/iuvlhJfv8uSSCagoUHWA20PSOFj82ofpEtyb64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047