UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T3tTCSEQy3FRA/WrpPSt5Q7WVMQYfFamRbajOKq7hrU=' 
WHERE 
  key_id = '641127c72f57e64882fcb947ce58f19fe03d95dea6a7163496446833b02fff11' 
  AND (
    token = 'T3tTCSEQy3FRA/WrpPSt5Q7WVMQYfFamRbajOKq7hrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038