UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm9q3xMEwvX8y7xm+1+H1jvFbcaO8jlFbIqva1Pz8tHk=' 
WHERE 
  key_id = '752b5dccebad2c42caef5f244423ab494e90f7dd74b3e545898e3662ac76f514' 
  AND (
    token = 'm9q3xMEwvX8y7xm+1+H1jvFbcaO8jlFbIqva1Pz8tHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059