UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sqwhPER3iE1+DHDrDG6lRWza4wQSOYGWIiZRpb+K9g8='
WHERE
key_id = '58cc416bc11912f178365769b826a46f1494bdcd33814dcd7a59ad29f110df15'
AND (
token = 'sqwhPER3iE1+DHDrDG6lRWza4wQSOYGWIiZRpb+K9g8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)