UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FlOb1kxaS9QRGHLHS+UOG21+sT4FEsSmauatsvafN4c=' 
WHERE 
  key_id = '103f5b117b04a38f1a443eace4c4e6a4c250d4255094bfcfe882a39b2b8faf02' 
  AND (
    token = 'FlOb1kxaS9QRGHLHS+UOG21+sT4FEsSmauatsvafN4c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026