UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yAGmmOSOuoWtdKeklqy3RA/xavJFo6caLczN3ZtVH8M='
WHERE
key_id = 'f46ada2475b9414e995365e38b0e2b841499b07a3f4b2383890fc994cb1fb9d9'
AND (
token = 'yAGmmOSOuoWtdKeklqy3RA/xavJFo6caLczN3ZtVH8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)