UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1zes5Wr1Z2e6uUJWHuvwcDy+KjeP2oj3UFi20t4rRSI=' 
WHERE 
  key_id = '97b89ebf45cff38c41714fc5e2c93f9516d345f35e9047f5935ffd0c0f336082' 
  AND (
    token = '1zes5Wr1Z2e6uUJWHuvwcDy+KjeP2oj3UFi20t4rRSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047