UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OeE0FpBbwnpMQy97ZRRE+Oz22pGS1m4iUnKfFjGj5Qc=' 
WHERE 
  key_id = 'd9bed421bc96d4c16857c25369d4ac3dcac92bcbd38da55e29f0344f7e66889e' 
  AND (
    token = 'OeE0FpBbwnpMQy97ZRRE+Oz22pGS1m4iUnKfFjGj5Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047