UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ztW7Kvj1wbm74oiHY6inuaqqfXxlmTIdZFgbq9XTZis='
WHERE
key_id = 'd2bcb5323d7a1cdf0d7d74e37a5afffd1c222530841b92ca09d0848731ea42e7'
AND (
token = 'ztW7Kvj1wbm74oiHY6inuaqqfXxlmTIdZFgbq9XTZis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)