UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'miMaznLxefeFWyDm0OHwpiY4zsL9n+wbOdPX9mEuvwI='
WHERE
key_id = '4f16bfca50fcca6747228ea2fd5d1963ea26b2a5d9baac4c0ada296def77f247'
AND (
token = 'miMaznLxefeFWyDm0OHwpiY4zsL9n+wbOdPX9mEuvwI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)