UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IZG8bINtJBh15DzJPX9UfTQ4CUP3+gr/LwdoM+m8IrI='
WHERE
key_id = 'e96a84b14ab4ca991401dade193eba6505d7423d45d72e504f5652b697862ee5'
AND (
token = 'IZG8bINtJBh15DzJPX9UfTQ4CUP3+gr/LwdoM+m8IrI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)