UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lOf0CSa58+Qv76LXo1dcqj5yBvjq6AtiZhUl9ks76Wc='
WHERE
key_id = 'a0a4d144aacc1ce86ce7dfd7581686cd382172e119f26d8408efc59042a03c34'
AND (
token = 'lOf0CSa58+Qv76LXo1dcqj5yBvjq6AtiZhUl9ks76Wc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)