UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ew1PmBSPjztNJvX647HSdQBAhlZoKDrwG9RbjA8dvC4='
WHERE
key_id = '79e5adba4b94d611a00c6dd51ebfc7470dded5db2ca87b7cdce748d2858f50c9'
AND (
token = 'Ew1PmBSPjztNJvX647HSdQBAhlZoKDrwG9RbjA8dvC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)