UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XjmsAiy2obuI/mQc7mhzjnM5JdaWywFgo8rRiAXa06M=' 
WHERE 
  key_id = '8005125e16583d4112459598579867390c1905b37243f482070194ba4b4af807' 
  AND (
    token = 'XjmsAiy2obuI/mQc7mhzjnM5JdaWywFgo8rRiAXa06M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024