UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2MD3CkrhD8u8zJqeCFT+vHUlUoUWL9YM4JWn64cRSZ0='
WHERE
key_id = '16956a0e2e0f17d03aec14ac77ff6c3adbd5084ae256d4cca08fc5accdd85551'
AND (
token = '2MD3CkrhD8u8zJqeCFT+vHUlUoUWL9YM4JWn64cRSZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)