UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DPINamKj1XYcDV2viTOM+UFZKgCgXVy343L3NAL2H+M=' 
WHERE 
  key_id = '29e5f1c109e0faf6d4a8e4c6064e17bea1e61cc335721e9c6793c110ef24b7fa' 
  AND (
    token = 'DPINamKj1XYcDV2viTOM+UFZKgCgXVy343L3NAL2H+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032