UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S3mwGOwiV3c/31RwUlEBAU9xfZEILHmzKuP9VFT2E8U='
WHERE
key_id = '95aac53bafb96ee3ae655951100df39d9aa058f989efc7b166e901633daeff30'
AND (
token = 'S3mwGOwiV3c/31RwUlEBAU9xfZEILHmzKuP9VFT2E8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)