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