UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N1GyhWepOoDDiFRIfB4YUXDlyaiFkZDUOZSYwnOIQkU='
WHERE
key_id = 'e48b2c88143048507f58adc0a801fc0ecd35100f19e0c80774fd84bca5d2f1e2'
AND (
token = 'N1GyhWepOoDDiFRIfB4YUXDlyaiFkZDUOZSYwnOIQkU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)