UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TjWJ6tiKHbS1rsKpny9gPhzbvu4KHxH+xupo2v97U40='
WHERE
key_id = '3f5d2bc74446748b373a8649822a6473b1a471a2ec6eae7c93ef1678269f6fd4'
AND (
token = 'TjWJ6tiKHbS1rsKpny9gPhzbvu4KHxH+xupo2v97U40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)