UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X0Vo1WVF/McwuAmN4eZ7zzW7q5YVnQF8rWAHevkV8s8=' 
WHERE 
  key_id = 'f6603cb0637580a56e15480fdb243cb29480d9dde30090c7517e0863035ef540' 
  AND (
    token = 'X0Vo1WVF/McwuAmN4eZ7zzW7q5YVnQF8rWAHevkV8s8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028