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