UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pXyHPtf4sHVjLXyxI8batVxsYcry2bC3jN5OlKiUILc='
WHERE
key_id = '7b961b6ff30981b9a35857e1c40a349f58ea31a6e44720b686abfaddc2235800'
AND (
token = 'pXyHPtf4sHVjLXyxI8batVxsYcry2bC3jN5OlKiUILc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)