UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xb3TyCmgb7MOSqs6A9hyxT61OmO2x9ZsX+iZNaReiUk='
WHERE
key_id = '393a67743dfbe7159ab9a8e3018fd8c2cb7d2df9b6077c51cdd6efc9273a2061'
AND (
token = 'xb3TyCmgb7MOSqs6A9hyxT61OmO2x9ZsX+iZNaReiUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)