UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '08382/YXasbS3O8/uNlIj217pagqfkt8x8exvDXF46U='
WHERE
key_id = '8d34d9467633967bb6935002df5430afaaacec91fd1acefc09ab28158add098e'
AND (
token = '08382/YXasbS3O8/uNlIj217pagqfkt8x8exvDXF46U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)