UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1gSZmbx60aCHQJ/enc2OGef+YuR7nE0X6UoVQ3hVQSs='
WHERE
key_id = 'f2157edc7cac0b93a0d23086da5cfdf4ad44f1c99d017394e6fbcfc285301744'
AND (
token = '1gSZmbx60aCHQJ/enc2OGef+YuR7nE0X6UoVQ3hVQSs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)