UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bBPt7EXpJsUTu5/opralORw5ZKagblV+DfsPUMT9Nh0='
WHERE
key_id = 'e604096fd775db84adfc77a6ee5470ed577ee6fea37dbac210efd51baf68ed4f'
AND (
token = 'bBPt7EXpJsUTu5/opralORw5ZKagblV+DfsPUMT9Nh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)