UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8PIz4wyuuhzciMsTDutaUZIlqJUCdNGGyg632147RN8='
WHERE
key_id = 'c8acb00ca7fe81d43a8716f100155a9f5bb59825d71be8588ec948450775498e'
AND (
token = '8PIz4wyuuhzciMsTDutaUZIlqJUCdNGGyg632147RN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)