UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bgSexV7EyN9u8wZ+tUKy8MXr20jaWT3HX0aYdL7sIBM=' 
WHERE 
  key_id = '25bbee107b4597d90c8bd4496f5c2c8b96723776ffe787a8237952368ca38552' 
  AND (
    token = 'bgSexV7EyN9u8wZ+tUKy8MXr20jaWT3HX0aYdL7sIBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041