UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hm5ZlliGijSUnCSwU5dgfRxy+zTai0BA00mDMyyj3bA='
WHERE
key_id = 'd4beb1dfefbbfe8c53b203d496f177e8ad2c1f8b919ea8dfa2ffbf69ab8be4d7'
AND (
token = 'Hm5ZlliGijSUnCSwU5dgfRxy+zTai0BA00mDMyyj3bA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)