UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L5xk6afkrb3uG7Xqi0MFRE1b1ox8fXX/DH+7kygEYYg=' 
WHERE 
  key_id = '8f3d12d81c8d5ff2b6185c07ae178b21d826cac4529825f4e1836ce322e73543' 
  AND (
    token = 'L5xk6afkrb3uG7Xqi0MFRE1b1ox8fXX/DH+7kygEYYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037