UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AdbdnmWMGkU333XL3I1JpZf5trEdastrtQ0eZVT3ABs='
WHERE
key_id = '58d9073af55454a4fe43709e411aca4c547f55821f672ef0cfeb9bd68359497d'
AND (
token = 'AdbdnmWMGkU333XL3I1JpZf5trEdastrtQ0eZVT3ABs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)