UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LT40DskFbAESOWxWqIrWlvHIxoxinees1Dts3vqVeZ0=' 
WHERE 
  key_id = 'f578ded38e6e7b9bad83d38f80d2e9e47c4c2ba6945172659a68af3be290fb17' 
  AND (
    token = 'LT40DskFbAESOWxWqIrWlvHIxoxinees1Dts3vqVeZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021