UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nPYckys4CXUx39U36/rMa1gX3QeuBHHqPRfLWhSzm8o='
WHERE
key_id = 'ba6701aff900a41b326d1f8cb7993095c55ff291e9987c221e3c1443829d25b2'
AND (
token = 'nPYckys4CXUx39U36/rMa1gX3QeuBHHqPRfLWhSzm8o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)