UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u5/sa1WDBPulZJoPz4gCGRPijPu2EKFWB0YO2vQnTqM='
WHERE
key_id = 'e9c7bf128f52e99c055274984a29f8fac09e76ae203a5590d7b244fb759020f5'
AND (
token = 'u5/sa1WDBPulZJoPz4gCGRPijPu2EKFWB0YO2vQnTqM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)