UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9SP19/5y1tiULMnYgAqZ6FmgO2j+uPK3DuQ1pCibFWI='
WHERE
key_id = '606bc388ab881b08c9f5d6fd67e97b788497f8c83e5e85518a0f00706f5171d0'
AND (
token = '9SP19/5y1tiULMnYgAqZ6FmgO2j+uPK3DuQ1pCibFWI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)