UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6fCFVKotljUuybSL47eM+So2jboY9GDPoGDq9eQG0jo='
WHERE
key_id = '4ae6718fd865deefc386fedab993777c32a7546e73298884607863f04fc9f4a7'
AND (
token = '6fCFVKotljUuybSL47eM+So2jboY9GDPoGDq9eQG0jo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)