UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JMk5bkx21y0Jnft15iJtTnELDYJS6ve2A55O3zIoRJc='
WHERE
key_id = '9ae31fdade17e53d1777011f1754437bef21a6b8ac1e230117c3a3a3a5eef7bf'
AND (
token = 'JMk5bkx21y0Jnft15iJtTnELDYJS6ve2A55O3zIoRJc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)